 /**
 * 扑克模型
 * @constructor
 */

var PokerID = {
  //方块            梅花           红心            黑桃
    BLOCK_2: 20,    CLUB_2: 21,    HEART_2: 22,    SPADE_2: 23,          //2
    BLOCK_3: 30,    CLUB_3: 31,    HEART_3: 32,    SPADE_3: 33,          //3
    BLOCK_4: 40,    CLUB_4: 41,    HEART_4: 42,    SPADE_4: 43,          //4
    BLOCK_5: 50,    CLUB_5: 51,    HEART_5: 52,    SPADE_5: 53,          //5
    BLOCK_6: 60,    CLUB_6: 61,    HEART_6: 62,    SPADE_6: 63,          //6
    BLOCK_7: 70,    CLUB_7: 71,    HEART_7: 72,    SPADE_7: 73,          //7
    BLOCK_8: 80,    CLUB_8: 81,    HEART_8: 82,    SPADE_8: 83,          //8
    BLOCK_9: 90,    CLUB_9: 91,    HEART_9: 92,    SPADE_9: 93,          //9
    BLOCK_10: 100,  CLUB_10: 101,  HEART_10: 102,  SPADE_10: 103,         //10
    BLOCK_J: 110,   CLUB_J: 111,   HEART_J: 112,   SPADE_J: 113,         //J
    BLOCK_Q: 120,   CLUB_Q: 121,   HEART_Q: 122,   SPADE_Q: 123,         //Q
    BLOCK_K: 130,   CLUB_K: 131,   HEART_K: 132,   SPADE_K: 133,         //K
    BLOCK_A: 140,   CLUB_A: 141,   HEART_A: 142,   SPADE_A: 143          //A
};

var Poker_id = [
    PokerID.BLOCK_2, PokerID.CLUB_2, PokerID.HEART_2, PokerID.SPADE_2, 
    PokerID.BLOCK_3, PokerID.CLUB_3, PokerID.HEART_3, PokerID.SPADE_3,
    PokerID.BLOCK_4, PokerID.CLUB_4, PokerID.HEART_4, PokerID.SPADE_4, 
    PokerID.BLOCK_5, PokerID.CLUB_5, PokerID.HEART_5, PokerID.SPADE_5,
    PokerID.BLOCK_6, PokerID.CLUB_6, PokerID.HEART_6, PokerID.SPADE_6, 
    PokerID.BLOCK_7, PokerID.CLUB_7, PokerID.HEART_7, PokerID.SPADE_7,
    PokerID.BLOCK_8, PokerID.CLUB_8, PokerID.HEART_8, PokerID.SPADE_8, 
    PokerID.BLOCK_9, PokerID.CLUB_9, PokerID.HEART_9, PokerID.SPADE_9,
    PokerID.BLOCK_10, PokerID.CLUB_10, PokerID.HEART_10, PokerID.SPADE_10, 
    PokerID.BLOCK_J, PokerID.CLUB_J, PokerID.HEART_J, PokerID.SPADE_J,
    PokerID.BLOCK_Q, PokerID.CLUB_Q, PokerID.HEART_Q, PokerID.SPADE_Q, 
    PokerID.BLOCK_K, PokerID.CLUB_K, PokerID.HEART_K, PokerID.SPADE_K,
    PokerID.BLOCK_A, PokerID.CLUB_A, PokerID.HEART_A, PokerID.SPADE_A
    ];
    
var Poker = function (pid) {
    if (pid >= 52) {
        cc.error("pid more then 52");
    }
    
    this.pid = pid;
    this.id = Poker_id[pid];
    this.rank = parseInt(this.id / 10);
    this.type = this.id % 10;
    this.touched = false;
    this.node = null;
};

Poker.prototype.getPid = function () {
    return this.pid;
};

Poker.prototype.getId = function () {
    return this.id;
};

Poker.prototype.getRank = function () {
    return this.rank;
};

Poker.prototype.getType = function () {
    return this.type;
};

Poker.prototype.getTouched = function () {
    return this.touched;
};

Poker.prototype.getNode = function () {
    return this.node;
};

Poker.prototype.setTouched = function (value) {
    this.touched = value;
};

Poker.prototype.setNode = function (value) {
    this.node = value;
};

module.exports = Poker;